<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	template="/WEB-INF/templates/template.xhtml">
	<ui:define name="content">
		<h1>
			<h:outputText value="Hello From JSF" />
		</h1>
		Message : #{homeBean.message}<br />
		<br />

		<h:form id="formTaskHome" >

			<p:panel header="Cadastro de responsavel"
				style="whidt:800px; heigth:200;">
				<h:panelGrid columns="1" id="painel" width="100%">

					<h:outputText value="Nome :" style="width:100" />
					<p:inputText id="taskDesc" style="width:500;"
						value="#{taskHome.task.description}"
						title="informe o nome do responsavel" />

				</h:panelGrid>
			</p:panel>

			<p:toolbar align="center" style="whidt:8px;">
				<p:toolbarGroup align="center">
					<p:commandButton value="Salvar" action="#{taskHome.save}"
						update="painelLista,painel" />
				</p:toolbarGroup>
			</p:toolbar>

			<h:panelGrid id="painelLista" columns="1"
				style="max-width: 800px; min-width: 800px">
				<p:dataTable var="listTasks" id="tableLista"
					value="#{taskHome.tasks}" paginator="true" rows="5"
					style="max-width: 800px; min-width: 800px"
					emptyMessage="Nenhum registro.">

					<p:column
						style="max-width: 25px; min-width: 25px; overflow: hidden">
						<f:facet name="header" width="5%">
							<h:outputText value="Codigo" />
						</f:facet>
						<h:outputText value="#{listTasks.id}" />
					</p:column>

					<p:column
						style="max-width: 450px; min-width: 450px; overflow: hidden">
						<f:facet name="header">
							<h:outputText value="Nome" width="95%" />
						</f:facet>
						<h:outputText value="#{listTasks.description}" />
					</p:column>


					<p:column width="15%">
						<p:commandButton title="Editar" update="painel" immediate="true"
							action="#{taskHome.edit}" ajax="false"
							icon="ui-icon-folder-open">
							<f:setPropertyActionListener target="#{taskHome.selected}" 
								value="#{listTasks}" />
						</p:commandButton>
					</p:column>
					
					<p:column width="15%">
						<p:commandButton title="Excluir" update="painel" immediate="true"
							action="#{taskHome.remove}" ajax="false"
							icon="ui-icon-folder-open">
							<f:setPropertyActionListener target="#{taskHome.selected}"
								value="#{listTasks}" />
						</p:commandButton>
					</p:column>

				</p:dataTable>
			</h:panelGrid>

		</h:form>

	</ui:define>
</ui:composition>
